fix(files): use incremental applyEdits to prevent streaming flicker in Monaco editor#4347
fix(files): use incremental applyEdits to prevent streaming flicker in Monaco editor#4347waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview When incoming content is purely additive, the editor now inserts only the new suffix at the end; otherwise it falls back to replacing the full model range, and removes the previous view-state save/restore workaround. Reviewed by Cursor Bugbot for commit 1b76937. Configure here. |
Greptile SummaryThis PR replaces Confidence Score: 5/5Safe to merge — targeted, well-reasoned fix with no new regressions introduced. The change is small and focused. The two previously-raised P1 concerns (stale-ref invariant and undo-stack pollution) are both resolved in the final commit. The additive path correctly uses the live monacoValue snapshot, applyEdits bypasses the undo stack as intended, and removal of the save/restore view state pair is correct since applyEdits preserves scroll position natively. No P0 or P1 issues remain. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Effect fires: content changed or isStreamInteractionLocked changed] --> B{monacoValue === content?}
B -- Yes --> C[Early return — no-op]
B -- No --> D{isStreamInteractionLocked OR monacoValue === lastSyncedContentRef?}
D -- No --> C2[Skip sync — user is actively editing]
D -- Yes --> E[Capture scroll-stuck state]
E --> F[suppressScrollListener = true]
F --> G{content.startsWith monacoValue AND monacoValue shorter?}
G -- Yes: additive --> H[applyEdits: insert suffix at end of last line]
G -- No: non-additive --> I[applyEdits: replace full model range]
H --> J[suppressScrollListener = false]
I --> J
J --> K[lastSyncedContentRef = content]
Reviews (3): Last reviewed commit: "fix(files): revert to applyEdits to avoi..." | Re-trigger Greptile |
…h VS Code streaming pattern
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 00ef26b. Configure here.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1b76937. Configure here.
…n Monaco editor (#4347) * fix(files): use incremental applyEdits to prevent streaming flicker in Monaco editor * fix(files): use actual model value for additive applyEdits guard * fix(files): use pushEditOperations instead of applyEdits to align with VS Code streaming pattern * fix(files): revert to applyEdits to avoid polluting undo stack during streaming
Summary
model.setValue()withmodel.applyEdits()when syncing streamed content into the Monaco editor during Mothership file generationapplyEditsfor non-additive changes (e.g. patch operations)saveViewState/restoreViewStatepair —applyEditspreserves scroll and cursor state nativelyType of Change
Testing
Tested manually
Checklist